#!/usr/bin/python2


def count(stream):
    nchar = 0;
    nbyte = 0;
    nword = 0;
    nline = 0;
    maxlinelen = 0
    while True:
        line = stream.readline()
        if line == '':
            break

        if line[-1] == '\n':
            nline += 1

        nbyte += len(line)
        nchar += len(line.decode("utf8"))
        if line[-1] == '\n':
            linelen = len(line) - 1
        else:
            linelen = len(line)

        maxlinelen = max(linelen, maxlinelen)

        # counting words is a little bit complicated
        # consider the following situations
        # ^123 4  567  89   $
        # ^    1 2 3 $
        # ^     $
        for x in line.strip().split():
            if x != '':
                nword += 1

    return nline, nword, nchar, nbyte, maxlinelen

if __name__ == "__main__":
    from optparse import OptionParser
    parser = OptionParser()

    parser.add_option('-c', '--bytes',
                      action='store_true', dest='is_showbytes',
                      help = 'print the byte counts')
    parser.add_option('-m', '--chars',
                      action='store_true', dest='is_showchars',
                      help = 'print the character counts')
    parser.add_option('-l', '--lines',
                      action='store_true', dest='is_showlines',
                      help = 'print the newline counts')
    parser.add_option('-L', '--max-line-lenght',
                      action='store_true', dest='is_show_maxlinelen',
                      help = 'print the length of the longest line')
    parser.add_option('-w', '--words',
                      action='store_true', dest='is_showwords',
                      help = 'print the word counts')

    (options, args) = parser.parse_args()

    import sys
    nline, nword, nchar, nbyte, maxlinelen = count(sys.stdin)
    if (len(sys.argv) == 1):
        print nline, nword, nbyte
    else:

        if options.is_showlines:
            print nline,
        if options.is_showwords:
            print nword,

        if options.is_showchars:
            print nchar,
        if options.is_showbytes:
            print nbyte,

        if options.is_show_maxlinelen:
            print maxlinelen,

        print
